<template>
  <view class="phxx-item">
    <view class="phxx-item-content">
      <view class="top">
        <view class="cname-box">
          <view class="cname">{{ itemList.vehicleNo || '' }}</view>
          <view class="cname-fu-box">
            <view class="cname-fu">
              <text class="" v-if="itemList.queueType == 1">
                {{ itemList.purchaserName || '' }}
              </text>
              <text class="" v-if="itemList.queueType == 2">{{
                itemList.customerName || ''
                }}</text>
            </view>
            <view class="line" v-if="!!itemList.purchaserName || !!itemList.customerName"></view>
            <view class="cname-fu">
              <text class="val" v-if="type == 1">{{
                itemList.coalSubtypeName || ''
                }}</text>
              <text class="val" v-else>{{
                itemList.purchaseCoalName || ''
                }}</text>
            </view>
          </view>
        </view>
        <view :class="{
            'gray-type': itemList.queueStatus == 10000,
            'orange-type':
              itemList.queueStatus == 30010 ||
              (itemList.queueStatus >= 60020 && itemList.queueStatus <= 60040),
            'blue-type':
              itemList.queueStatus == 10010 || itemList.queueStatus == 40010,
            'green-type':
              itemList.queueStatus == 90000 ||
              (itemList.queueStatus >= 40040 && itemList.queueStatus <= 60010),
            'red-type':
              itemList.queueStatus == 40020 || itemList.queueStatus == 40030,
            status: true
          }">{{ itemList.queueStatusName }}</view>
      </view>
      <view class="bottom mt8" v-if="type == 1">
        <view class="items full">
          <text class="til">排队类型:</text>
          <text v-if="itemList.queueType" class="val">
            {{itemList.queueType===1 ? '采购' : '销售'}}
          </text>
        </view>
      </view>
      <view class="bottom mt8" v-if="type == 1">
        <view class="items full">
          <text class="til">排队费用:</text>
          <text v-if="itemList.lineupCostConf" class="val">{{
            !!itemList.lineupCostConf ? itemList.lineupCostConf / 100 : ''
            }}元</text>
        </view>
      </view>
      <view class="bottom mt8" v-if="type == 2">
        <view class="items">
          <text class="til">司机姓名:</text>
          <text class="val">{{ itemList.driverName || '' }}</text>
        </view>
        <view class="items">
          <text class="til">车道:</text>
          <text class="val">{{ itemList.laneName || '' }}</text>
        </view>
      </view>
      <view class="bottom" v-if="goodsType == 'phurchase'">
        <view class="items full">
          <text class="til">装货地址:</text>
          <text class="val">{{ itemList.loadingSiteName || '' }}</text>
        </view>
      </view>
      <view class="bottom" v-if="goodsType == 'sale'">
        <view class="items full">
          <text class="til">卸货地址:</text>
          <text class="val">{{ itemList.unLoadingSiteName || '' }}</text>
        </view>
      </view>
      <view class="bottom" v-if="type == 1">
        <view class="items full">
          <text class="til">排号时间:</text>
          <text class="val">{{ itemList.queueTime || '' }}</text>
        </view>
      </view>
      <view class="bottom" v-if="type == 1">
        <view class="items full">
          <text class="til">叫号时间:</text>
          <text class="val">{{ itemList.callNumberTime || '' }}</text>
        </view>
      </view>

      <view class="bottom" v-if="type == 2">
        <view class="items full">
          <text class="til">停车场排号时间:</text>
          <text class="val">{{ itemList.queueTime || '' }}</text>
        </view>
      </view>
      <view class="bottom" v-if="type == 2">
        <view class="items full">
          <text class="til">停车场叫号时间:</text>
          <text class="val">{{ itemList.callNumberTime || '' }}</text>
        </view>
      </view>
      <!-- <view class="bottom">
				<view class="cancelBtn" @click="queueRule">排号规则</view>
				<view>
					<button class="cancelBtn" size="mini" @click="cancel()">作废</button>
				</view> 
			</view>-->
    </view>
  </view>
</template>

<script>
  export default {
    name: 'row-number',
    props: {
      itemList: {
        type: Object,
        default: {
          vehicleNo: '',
          driverName: '',
          queueStatusName: '',
          customerName: '',
          purchaserName: '',
          coalSubtypeName: '',
          loadingSiteName: '',
          queueTime: '',
          callNumberTime: ''
        }
      },
      type: {
        type: Number,
        default: 1
      }
    },
    data() {
      return {
        goodsType: undefined
      };
    },
    onshow() {
      this.goodsType = this.itemList.queueType == 2 ? 'sale' : 'phurchase';
    },
    methods: {
      cancel() { },
      queueRule() { },
      handleClick(item, type) {
        console.log(item);
        this.$emit('manualCalling', item, type);
      }
    }
  };
</script>

<style lang="scss" scoped>
  .phxx-item {
    margin-bottom: 20rpx;
  }
</style>